﻿using UnityEditor;
using UnityEngine;

[CanEditMultipleObjects, CustomEditor(typeof(LogicalEffectManager))]
public class LogicalEffectManagerEditor : Editor
{
    LogicalEffectManager manager;
    private void OnEnable()
    {
        manager = serializedObject.targetObject as LogicalEffectManager;
    }
    public override void OnInspectorGUI()
    {
        EffectSystem effectSystem = manager.transform.Find("/GameManager").GetComponent<EffectSystem>();
        if (effectSystem == null) return;
        serializedObject.Update();
        manager.initEffectNameList = EditorGUILayout.MaskField("初始化Effect：", manager.initEffectNameList, effectSystem.GetEffectDataNameArr());
        manager.initBanedEffectNameList = EditorGUILayout.MaskField("初始化BandEffect：", manager.initBanedEffectNameList, effectSystem.GetEffectNameArr());
        base.OnInspectorGUI();
        if(GUI.changed)
        {
            EditorUtility.SetDirty(manager);
        }
        //serializedObject.ApplyModifiedProperties();
    }
}
